//
//  PCDApiNavigateDo.m
//  PCDBank
//
//  Created by DK on 2021/2/26.
//  Copyright © 2021 DK. All rights reserved.
//

#import "PCDApiNavigateDo.h"

@implementation PCDNavBaseDo

-(id)initWithDict:(NSDictionary *)dict{
    
    if (self =[super init]) {
        
        [self parseEntityWithDictionary:dict];
    }
    return self;
}

-(void)parseEntityWithDictionary:(NSDictionary *)arributeDict
{
    for(int i = 0 ; i < [arributeDict count] ; i++)
    {
        NSString * attributeStr = [[arributeDict allKeys] objectAtIndex:i];
        NSString * tempMethodStr=nil;
        NSString * firstLetter=[[attributeStr substringToIndex:1] uppercaseString];
        tempMethodStr=[attributeStr stringByReplacingCharactersInRange:NSMakeRange(0,1) withString:firstLetter];
        SEL performedSelector = NULL;
        if ([[arributeDict objectForKey:attributeStr] isKindOfClass:[NSString class]])
        {
            performedSelector = NSSelectorFromString([NSString stringWithFormat:@"set%@:",tempMethodStr]);
        }
        if ([[arributeDict objectForKey:attributeStr] isKindOfClass:[NSArray class]])
        {
            performedSelector = NSSelectorFromString([NSString stringWithFormat:@"set%@:",tempMethodStr]);
        }
        if ([self respondsToSelector:performedSelector])
        {
            NSMethodSignature * methodSignature = [[self class] instanceMethodSignatureForSelector:performedSelector];
            NSInvocation * invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
            [invocation setTarget:self];
            [invocation setSelector:performedSelector];
            NSObject * argument = [arributeDict objectForKey:attributeStr];
            [invocation setArgument:&argument atIndex:2];
            [invocation invoke];
        }
    }
}

@end

@implementation PCDNavOptionsDo

@end

@implementation PCDNavTabBarDo

@end

@implementation PCDApiNavigateDo

@end
